<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>GEN11</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="GEN10.html" title="GEN10" />
    <link rel="next" href="GEN12.html" title="GEN12" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN11</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN10.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN12.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="GEN11"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN11" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN11</span>
        </h2>
        <p>GEN11 — 
      Generates an additive set of cosine partials.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp214098368"></a>
        <h2>Description</h2>
        <p>
      This subroutine generates an additive set of cosine partials, in the manner of Csound generators <a class="link" href="buzz.html" title="buzz"><em class="citetitle">buzz</em></a> and <a class="link" href="gbuzz.html" title="gbuzz"><em class="citetitle">gbuzz</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp214142624"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 11 nh [lh] [r]</pre>
      </div>
      <div class="refsect1">
        <a id="idp214144688"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see <a class="link" href="f.html" title="f Statement (or Function Table Statement)"><em class="citetitle">f statement</em></a>).
    </p>
        <p>
      <span class="emphasis"><em>nh</em></span> -- number of harmonics requested. Must be positive.
    </p>
        <p>
      <span class="emphasis"><em>lh</em></span>(optional) -- lowest harmonic partial present. Can be positive, zero or negative. The set of partials can begin at any partial number and proceeds upwards; if <span class="emphasis"><em>lh</em></span> is negative, all partials below zero will reflect in zero to produce positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set. The default value is 1
    </p>
        <p>
      <span class="emphasis"><em>r</em></span>(optional) -- multiplier in an amplitude coefficient series. This is a power series: if the <span class="emphasis"><em>lh</em></span>th partial has a strength coefficient of A the (<span class="emphasis"><em>lh</em></span> + n)th partial will have a coefficient of A * r<sup>n</sup>, i.e. strength values trace an exponential curve. <span class="emphasis"><em>r</em></span> may be positive, zero or negative, and is not restricted to integers. The default value is 1.
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
       </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist" style="list-style-type: disc; ">
                    <li class="listitem">
                      <p>
             This subroutine is a non-time-varying version of the CSound <a class="link" href="buzz.html" title="buzz"><em class="citetitle">buzz</em></a>and <a class="link" href="gbuzz.html" title="gbuzz"><em class="citetitle">gbuzz</em></a> generators, and is similarly useful as a complex sound source in subtractive synthesis. With <span class="emphasis"><em>lh</em></span> and <span class="emphasis"><em>r</em></span> present it parallels <span class="emphasis"><em>gbuzz</em></span>; with both absent or equal to 1 it reduces to the simpler <span class="emphasis"><em>buzz</em></span> (i.e. <span class="emphasis"><em>nh</em></span> equal-strength harmonic partials beginning with the fundamental).
           </p>
                    </li>
                    <li class="listitem">
                      <p>
             Sampling the stored waveform with an oscillator is more efficient than using the dynamic buzz units. However, the spectral content is invariant and care is necessary, lest the higher partials exceed the Nyquist during sampling to produce fold-over.
           </p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp214161152"></a>
        <h2>Examples</h2>
        <p>
	    Here is an example of the GEN11 routine. It uses the files <a class="ulink" href="examples/gen01.csd" target="_top"><em class="citetitle">gen11.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp214163008"></a>
          <p class="title">
            <strong>Example 1101. An example of the GEN11 routine.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac      <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o gen11.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2 
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1 

<span class="oblock">instr</span> 1

ifn  <span class="op">=</span> p4
asig <span class="opc">oscil</span> .8, 220, ifn
     <span class="opc">outs</span> asig,asig
    
<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 16384 11 1 1	<span class="comment">;number of harmonics = 1</span>
<span class="stamnt">f</span> 2 0 16384 11 10 1 .7	<span class="comment">;number of harmonics = 10</span>
<span class="stamnt">f</span> 3 0 16384 11 10 5 2	<span class="comment">;number of harmonics = 10, 5th harmonic is amplified 2 times</span>


<span class="stamnt">i</span> 1 0 2 1
<span class="stamnt">i</span> 1 + 2 2
<span class="stamnt">i</span> 1 + 2 3
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

        <span class="phrase">These are the diagrams of the waveforms of the GEN11 routines, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen11_1.png" alt="f 1 0 16384 11 1 1" />
          <div class="caption">
            <p>f 1 0 16384 11 1 1</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen11_2.png" alt="f 2 0 16384 11 10 1 .7" />
          <div class="caption">
            <p>f 2 0 16384 11 10 1 .7</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen11_3.png" alt="f 3 0 16384 11 10 5 2" />
          <div class="caption">
            <p>f 3 0 16384 11 10 5 2</p>
          </div>
        </div>
        <p>

    </p>
      </div>
      <div class="refsect1">
        <a id="idp214175520"></a>
        <h2>See Also</h2>
        <p>
       <a class="link" href="GEN10.html" title="GEN10"><em class="citetitle">GEN10</em></a>
     </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN10.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="GEN12.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN10 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN12</td>
        </tr>
      </table>
    </div>
  </body>
</html>
